<?php
namespace UserSystem\Driver\DB;

use UserSystem\Config;

/**
 * Class Db_mongo
 * @author wangxi
 */
class Mongo
{
    private static $_instance;

    public function __construct()
    {
        if (!extension_loaded('php_mongo')) {
            die('php_mongo extension not loaded');
        }

    }

    public static function getInstance()
    {

    }

    public function testConnect()
    {
        //connect to local mongo server port at 27017
        $conn = new Mongo('127.0.0.1:27017');

        //access or create collection
        $db = $conn->selectDb('db');
        $person = $db->person;

        //insert data
        $person->insert(array(
            'name' => 'sunnyw',
            'job'  => 'php developer'
        ));

        var_dump($person);
    }
}